home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / ptv1n6.arc / INPUT2.CPP < prev    next >
Text File  |  1991-01-21  |  326b  |  13 lines

  1. // Listing 4: INPUT2.CPP.
  2. // inline assembly input() referencing C++ names
  3.  
  4. void statistician::input(int i)
  5. {
  6.   asm {
  7.     mov si, word ptr this     // Point to object data with si
  8.     mov ax, word ptr i        // Load AX with i
  9.     add word ptr [si].sum, ax // sum += i
  10.     inc word ptr [si].n       // n++
  11.   }
  12. }
  13.